package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name="book_type")
public class BookType extends play.db.jpa.Model{

	//上级分类 
	public Long fid;;
	
	//	类别名称 
	@Column(name="bot_name",length=100)
	public String botName; 
	 
	//	等级 
	@Column(name="bot_lev")
	public Integer botLev;
	 
	//	类型代号 
	@Column(name="bot_code",length=10)
	public String botCode;
	
	//设置子集分类

	public static BookType setSun(BookType ft){
		try{
			List<BookType> s = null;
			try{
				s = BookType.find("fid=?", ft.getId()).fetch();
			}catch(Exception e){}
			ft.setSTypes(s);
		}catch(Exception e){};
		return ft;
	}
	
	@Transient
	private List<BookType> sTypes;

	public List<BookType> getSTypes() {
		return sTypes;
	}

	public void setSTypes(List<BookType> types) {
		sTypes = types;
	}
	
}
